package com.alibaba.demo.service;

import com.alibaba.demo.provider.DemoProvider;
import com.alibaba.demo.util.DemoUtils;
import com.taobao.hsf.app.spring.util.HSFSpringProviderBean;

/**
 * 手动发布一个服务，用于做各类测试
 * @author Jason
 *
 */
public class PubService {

	public static void main(String[] args) throws InterruptedException {
		try {
			//加载sar
			DemoUtils.getServiceFactory();
			//代码方式发布服务
			HSFSpringProviderBean providerBean = new HSFSpringProviderBean();
			providerBean.setInterface("com.alibaba.demo.api.DemoApi");
			providerBean.setTarget(new DemoProvider());
			providerBean.setGroup("unittest");
			providerBean.init();
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("Pub Success.");
		Thread.sleep(60*60*1000);
	}

}
